package com.ikdong.toodle.model;

import java.util.Calendar;
import java.util.TimeZone;

import com.ikdong.toodle.util.ComUtil;

public class Task extends BasicTask{
	private String userid;
	private Long opStatus;
	
	public Long getOpStatus() {
		return opStatus;
	}
	public void setOpStatus(Long opStatus) {
		this.opStatus = opStatus;
	}
	public String getUserid() {
		return userid;
	}
	public void setUserid(String userid) {
		this.userid = userid;
	}
	
	public String getPriorityFormat(){
		String rlt = "";
		if(Long.valueOf(-1).equals(this.getPriority())){
			rlt = "Negative";
		}else if(Long.valueOf(0).equals(this.getPriority())){
			rlt = "Low";
		}else if(Long.valueOf(1).equals(this.getPriority())){
			rlt = "Medium";
		}else if(Long.valueOf(2).equals(this.getPriority())){
			rlt = "High";
		}else if(Long.valueOf(3).equals(this.getPriority())){
			rlt = "Top";
		}
		return rlt;
	}

	public String getStatusFormat() {
		String rlt = "";
		if(Long.valueOf(0).equals(this.getStatus())){
			rlt = "None";
		}else if(Long.valueOf(1).equals(this.getStatus())){
			rlt = "Next Action";
		}else if(Long.valueOf(2).equals(this.getStatus())){
			rlt = "Active";
		}else if(Long.valueOf(3).equals(this.getStatus())){
			rlt = "Planning";
		}else if(Long.valueOf(4).equals(this.getStatus())){
			rlt = "Delegated";
		}else if(Long.valueOf(5).equals(this.getStatus())){
			rlt = "Waiting";
		}else if(Long.valueOf(6).equals(this.getStatus())){
			rlt = "Hold";
		}else if(Long.valueOf(7).equals(this.getStatus())){
			rlt = "Postponed";
		}else if(Long.valueOf(8).equals(this.getStatus())){
			rlt = "Someday";
		}else if(Long.valueOf(9).equals(this.getStatus())){
			rlt = "Canceled";
		}else if(Long.valueOf(10).equals(this.getStatus())){
			rlt = "Reference";
		}
		
		return rlt;
	}
	
	public String getTimeFormat(long time){
		String st = null;
		Calendar calendar = Calendar.getInstance();
		calendar.setTimeZone(TimeZone.getTimeZone("GMT+0"));
		calendar.setTimeInMillis(ComUtil.parseDateByUS(time).getTime());
		st = calendar.get(Calendar.HOUR_OF_DAY)+":"+calendar.get(Calendar.MINUTE);
		return st;
	}
	
	public static String[] getColumns(){
		return new String[]{"_id", "userid","title","tag","folder","context","goal","parent","children","ord","duedate","duedatemod","startdate","duetime","starttime","remind","repeat","repeatfrom","status","length","priority","star","modified","completed","added","timer","timeron","meta","note","op_status"};
	}

}
